package com.yning.coroutines

import cn.youngning.coroutinedemo.model.Banner
import com.yning.coroutines.net.RetrofitHelper
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch

fun main(){
    GlobalScope.launch {
        try {
            val banners = RetrofitHelper.service.getBanners().await()
            showBanners(banners)
        }catch (e : Exception){
            e.printStackTrace()
        }
    }
}

suspend fun showBanners(banners:List<Banner>){
    println(banners)
}